/*
 * @Author: gitee_com_zb
 * @Date: 2024-12-16 14:54:04
 * @LastEditors: gitee_com_zb
 * @LastEditTime: 2024-12-16 14:54:20
 * @FilePath: /algorithm/每日一题13.判定是否互为字符重排(easy).cpp
 * @Description: 题目链接 https://leetcode.cn/problems/check-permutation-lcci
 */
class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        int hash1[26] = { 0 };
        int hash2[26] = { 0 };
        for(auto &x : s1) hash1[x-'a']++;
        for(auto &x : s2) hash2[x-'a']++;
        for(int i = 0; i < 26; i++) 
            if(hash1[i] != hash2[i]) return false;
        return true;  
    }
};